//
//  BwtServiceAdView.m
//  bwt_ad_flutter
//
//  Created by 帅 on 2025/6/24.
//

#import "BwtServiceAdView.h"
#import "BwtServiceAdManager.h"
@implementation BwtServiceAdView

//在这里只是创建了一个UILabel
-(instancetype)initWithWithFrame:(CGRect)frame viewIdentifier:(int64_t)viewId arguments:(id)args binaryMessenger:(NSObject<FlutterBinaryMessenger> *)messenger{
    if ([args isKindOfClass:[NSDictionary class]]) {
        NSDictionary *params = args;
        NSString *adId = params[@"adId"];
        
        if (adId) {
            BwtServiceAdManager *serviceAdManager = [BwtServiceAdManager getBwtBannerAdManager];
            self.serviceAdView = [serviceAdManager getBannerAdView:adId];
        }
    }
    return self;
}

- (nonnull UIView *)view {
    if (_serviceAdView) {
        return _serviceAdView;
    }
    return [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
}

@end
